package com.ww.yaodao.util;

public class ResponseDataUtil {

    public static ResponseData buildOk(String msg) {
        return new ResponseData(ResultEnums.OK.getStatus(), msg);
    }

    public static <T> ResponseData buildOk(T data) {
        return new ResponseData<T>(ResultEnums.OK, data);
    }

    public static <T> ResponseData<T> buildOk(String msg,T data) {
        return new ResponseData(ResultEnums.OK.getStatus(), msg,data);
    }

    public static ResponseData buildOk(int status , String msg) {
        return new ResponseData(status, msg);
    }

    public static <T> ResponseData buildOk(int status, String msg, T data) {
        return new ResponseData<T>(status, msg, data);
    }

    public static ResponseData buildOk(ResultEnums resultEnums) {
        return new ResponseData(resultEnums);
    }

    public static <T> ResponseData buildCreate(T data) {
        return new ResponseData<T>(ResultEnums.CREATED, data);
    }

    public static <T> ResponseData buildDelete(T data) {
        return new ResponseData<T>(ResultEnums.DELETED, data);
    }

    public static <T> ResponseData buildUpdate(T data) {
        return new ResponseData<T>(ResultEnums.UPDATED, data);
    }

    public static <T> ResponseData buildError(String msg) {
        return new ResponseData<T>(ResultEnums.INTERNAL_SERVER_ERROR.getStatus(),msg);
    }

}